/**
 * @mbggenerated
 * @author wujian
 */
package bearworker.zxl.dao.mapper;

import bearworker.zxl.entity.DeliveryUserReal;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface DeliveryUserRealMapper {
    /* @mbggenerated */
    @Delete({
        "delete from delivery_user_real",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    /* @mbggenerated */
    @Insert({
        "insert into delivery_user_real (user_id, real_name, ",
        "identity_card, identity_card_front, ",
        "identity_card_back, create_time)",
        "values (#{userId,jdbcType=INTEGER}, #{realName,jdbcType=VARCHAR}, ",
        "#{identityCard,jdbcType=VARCHAR}, #{identityCardFront,jdbcType=VARCHAR}, ",
        "#{identityCardBack,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(DeliveryUserReal record);

    /* @mbggenerated */
    @InsertProvider(type=DeliveryUserRealSqlProvider.class, method="insertSelective")
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insertSelective(DeliveryUserReal record);

    /* @mbggenerated */
    @Select({
        "select",
        "id, user_id, real_name, identity_card, identity_card_front, identity_card_back, ",
        "create_time",
        "from delivery_user_real",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.INTEGER),
        @Result(column="real_name", property="realName", jdbcType=JdbcType.VARCHAR),
        @Result(column="identity_card", property="identityCard", jdbcType=JdbcType.VARCHAR),
        @Result(column="identity_card_front", property="identityCardFront", jdbcType=JdbcType.VARCHAR),
        @Result(column="identity_card_back", property="identityCardBack", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP)
    })
    DeliveryUserReal selectByPrimaryKey(Integer id);

    /* @mbggenerated */
    @UpdateProvider(type=DeliveryUserRealSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(DeliveryUserReal record);

    /* @mbggenerated */
    @Update({
        "update delivery_user_real",
        "set user_id = #{userId,jdbcType=INTEGER},",
          "real_name = #{realName,jdbcType=VARCHAR},",
          "identity_card = #{identityCard,jdbcType=VARCHAR},",
          "identity_card_front = #{identityCardFront,jdbcType=VARCHAR},",
          "identity_card_back = #{identityCardBack,jdbcType=VARCHAR},",
          "create_time = #{createTime,jdbcType=TIMESTAMP}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(DeliveryUserReal record);
    
    @Select({
        "select",
        "id, user_id, real_name, identity_card, identity_card_front, identity_card_back, ",
        "create_time",
        "from delivery_user_real",
        "where user_id = #{userId,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.INTEGER),
        @Result(column="real_name", property="realName", jdbcType=JdbcType.VARCHAR),
        @Result(column="identity_card", property="identityCard", jdbcType=JdbcType.VARCHAR),
        @Result(column="identity_card_front", property="identityCardFront", jdbcType=JdbcType.VARCHAR),
        @Result(column="identity_card_back", property="identityCardBack", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP)
    })
    DeliveryUserReal selectByUserId(Integer userId);
}